import Vue from 'vue';
import Router from 'vue-router';

import HomePage from '@/components/home/HomePage';
import Login from '@/components/login/login';
import Register from '@/components/login/register';
import Resetword from '@/components/login/Resetword';
import ChangePassword from '@/components/login/ChangePassword';
import MessageList from '@/components/details/MessageList';
import SearchText from '@/components/details/SearchText';
import MessageDetails from '@/components/details/MessageDetails';
import PostMessage from '@/components/details/PostMessage';
import eHeader from '@/components/public/Header';
import Comment from '@/components/public/Comment';
import eContentFrame from '@/components/public/ContentFrame';
import eFooter from '@/components/public/Footer';
import Mypublish from '@/components/usercenter/Mypublish';
import MyPayA from '@/components/usercenter/MyPayA';
import Balance from '@/components/login/Balance';
import MyMessageDetails from '@/components/usercenter/MyMessageDetails';

Vue.use(Router);

/**
 * 重写路由的push方法
 */
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}

export default new Router({
  routes: [{
    // ************网站主页
    path: '/',
    name: 'HomePage',
    component: HomePage,
    meta: {
      //这个就是需要改变的title
      title: "视界信息_梦想始于晨曦"
    }
  },
  {
    // ************网站登录页
    path: '/Login',
    name: 'Login',
    component: Login,
    meta: {
      title: "用户登录"
    }
  },
  {
    // ************网站注册页
    path: '/Register',
    name: 'Register',
    component: Register,
    meta: {
      title: "用户注册"
    }
  },
  {
    // ************网站重置密码页
    path: '/Resetword',
    name: 'Resetword',
    component: Resetword,
    meta: {
      title: "用户密码重置"
    }
  },
  {
    // ************网站信息分类列表页
    path: '/MessageList',
    name: 'MessageList',
    component: MessageList,
    meta: {
      title: "信息分类列表"
    }
  },
  {
    // ************网站搜索列表页
    path: '/SearchText',
    name: 'SearchText',
    component: SearchText,
    meta: {
      title: "搜索信息列表"
    }
  },
  {
    // ************网站信息详情页
    path: '/MessageDetails',
    name: 'MessageDetails',
    component: MessageDetails,
    meta: {
      title: "信息详情"
    }
  },
  {
    // ************网站信息发布页
    path: '/PostMessage',
    name: 'PostMessage',
    component: PostMessage,
    meta: {
      title: "信息发布"
    }
  },
  {
    // ************网站主页头部
    path: '/eHeader',
    name: 'eHeader',
    component: eHeader,
    meta: {
      title: "主页头部"
    }
  }, {
    // ************网站主页主体
    path: '/eContentFrame',
    name: 'eContentFrame',
    component: eContentFrame,
    meta: {
      title: "主页主体"
    }
  },
  {
    // ************网站主页尾部
    path: '/eFooter',
    name: 'eFooter',
    component: eFooter,
    meta: {
      title: "主页尾部"
    }
  },
  {
    // ************网站修改密码页
    path: '/ChangePassword',
    name: 'ChangePassword',
    component: ChangePassword,
    meta: {
      title: "密码修改"
    }
  },
  {
    // ************网站用户中心个人文章页
    path: '/Mypublish',
    name: 'Mypublish',
    component: Mypublish,
    meta: {
      title: "个人文章"
    }
  },
  {
    // ************网站用户中心个人文章详情页
    path: '/MyMessageDetails',
    name: 'MyMessageDetails',
    component: MyMessageDetails,
    meta: {
      title: "个人文章详情"
    }
  },
  {
    // ************网站用户中心个人文章权限页
    path: '/MyPayA',
    name: 'MyPayA',
    component: MyPayA,
    meta: {
      title: "充值页面"
    }
  },
  {
    // ************网站用户中心个人余额页
    path: '/Balance',
    name: 'Balance',
    component: Balance,
    meta: {
      title: "个人余额"
    }
  },
  {
    // ************网站用户中心个人文章评论组件
    path: '/Comment',
    name: 'Comment',
    component: Comment,
    meta: {
      title: "文章评论"
    }
  },

  ]
});